home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 2000 October: Mac OS SDK / Dev.CD Oct 00 SDK1.toast / Development Kits / Cross Platform / QuickTime 4.1.2 Windows SDK / CIncludes / GXEnvironment.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-04-12  |  11.9 KB  |  334 lines  |  [TEXT/R*ch]

  1. /*
  2.      File:        GXEnvironment.h
  3.  
  4.      Contains:    QuickDraw GX environment constants and interfaces
  5.  
  6.      Version:    Technology:    Quickdraw GX 1.1
  7.                  Release:    QuickTime 4.1
  8.  
  9.      Copyright:    (c) 1994-1999 by Apple Computer, Inc., all rights reserved.
  10.  
  11.      Bugs?:        For bug reports, consult the following page on
  12.                  the World Wide Web:
  13.  
  14.                      http://developer.apple.com/bugreporter/
  15.  
  16. */
  17. #ifndef __GXENVIRONMENT__
  18. #define __GXENVIRONMENT__
  19.  
  20. #ifndef __CONDITIONALMACROS__
  21.     #include <ConditionalMacros.h>
  22. #endif
  23.  
  24. #ifndef __MIXEDMODE__
  25.     #include <MixedMode.h>
  26. #endif
  27.  
  28. #ifndef __QUICKDRAW__
  29.     #include <Quickdraw.h>
  30. #endif
  31.  
  32. #ifndef __GXTYPES__
  33.     #include <GXTypes.h>
  34. #endif
  35.  
  36. #ifndef __CMAPPLICATION__
  37.     #include <CMApplication.h>
  38. #endif
  39.  
  40.  
  41.  
  42.  
  43. #if PRAGMA_ONCE
  44. #pragma once
  45. #endif
  46.  
  47. #ifdef __cplusplus
  48. extern "C" {
  49. #endif
  50.  
  51. #if PRAGMA_IMPORT
  52. #pragma import on
  53. #endif
  54.  
  55. #if PRAGMA_STRUCT_ALIGN
  56.     #pragma options align=mac68k
  57. #elif PRAGMA_STRUCT_PACKPUSH
  58.     #pragma pack(push, 2)
  59. #elif PRAGMA_STRUCT_PACK
  60.     #pragma pack(2)
  61. #endif
  62.  
  63. #if defined(__MWERKS__) && TARGET_CPU_68K
  64.     #pragma push
  65.     #pragma pointers_in_D0
  66. #endif
  67.  
  68. /* old header = graphics macintosh */
  69.  
  70. enum {
  71.     defaultPollingHandlerFlags    = 0x00,
  72.     okToSwitchDuringPollFlag    = 0x00,
  73.     dontSwitchDuringPollFlag    = 0x01
  74. };
  75.  
  76. typedef long                             gxPollingHandlerFlags;
  77. typedef CALLBACK_API_C( void , gxPollingHandlerProcPtr )(long reference, gxPollingHandlerFlags flags);
  78. typedef STACK_UPP_TYPE(gxPollingHandlerProcPtr)                 gxPollingHandlerUPP;
  79. #if OPAQUE_UPP_TYPES
  80.     EXTERN_API(gxPollingHandlerUPP)
  81.     NewgxPollingHandlerUPP           (gxPollingHandlerProcPtr    userRoutine);
  82.  
  83.     EXTERN_API(void)
  84.     DisposegxPollingHandlerUPP       (gxPollingHandlerUPP        userUPP);
  85.  
  86.     EXTERN_API(void)
  87.     InvokegxPollingHandlerUPP       (long                    reference,
  88.                                     gxPollingHandlerFlags    flags,
  89.                                     gxPollingHandlerUPP        userUPP);
  90.  
  91. #else
  92.     enum { uppgxPollingHandlerProcInfo = 0x000003C1 };                 /* no_return_value Func(4_bytes, 4_bytes) */
  93.     #define NewgxPollingHandlerUPP(userRoutine)                     (gxPollingHandlerUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxPollingHandlerProcInfo, GetCurrentArchitecture())
  94.     #define DisposegxPollingHandlerUPP(userUPP)                     DisposeRoutineDescriptor(userUPP)
  95.     #define InvokegxPollingHandlerUPP(reference, flags, userUPP)     CALL_TWO_PARAMETER_UPP((userUPP), uppgxPollingHandlerProcInfo, (reference), (flags))
  96. #endif
  97. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  98. #define NewgxPollingHandlerProc(userRoutine)                     NewgxPollingHandlerUPP(userRoutine)
  99. #define CallgxPollingHandlerProc(userRoutine, reference, flags)    InvokegxPollingHandlerUPP(reference, flags, userRoutine)
  100. EXTERN_API_C( gxPollingHandlerUPP )
  101. GXGetGraphicsPollingHandler        (long *                    reference)                            THREEWORDINLINE(0x303C, 0x0245, 0xA832);
  102.  
  103. EXTERN_API_C( void )
  104. GXSetGraphicsPollingHandler        (gxPollingHandlerUPP     handler,
  105.                                  long                     reference)                            THREEWORDINLINE(0x303C, 0x0246, 0xA832);
  106.  
  107. /* old header = graphics toolbox */
  108.  
  109.  
  110. /* QD to QD GX Translator typedefs */
  111. enum {
  112.     gxDefaultOptionsTranslation    = 0x0000,
  113.     gxOptimizedTranslation        = 0x0001,
  114.     gxReplaceLineWidthTranslation = 0x0002,
  115.     gxSimpleScalingTranslation    = 0x0004,
  116.     gxSimpleGeometryTranslation    = 0x0008,                        /* implies simple scaling */
  117.     gxSimpleLinesTranslation    = 0x000C,                        /* implies simple geometry & scaling */
  118.     gxLayoutTextTranslation        = 0x0010,                        /* turn on gxLine layout (normally off) */
  119.     gxRasterTargetTranslation    = 0x0020,
  120.     gxPostScriptTargetTranslation = 0x0040,
  121.     gxVectorTargetTranslation    = 0x0080,
  122.     gxPDDTargetTranslation        = 0x0100,
  123.     gxDontConvertPatternsTranslation = 0x1000,
  124.     gxDontSplitBitmapsTranslation = 0x2000
  125. };
  126.  
  127. typedef long                             gxTranslationOption;
  128. enum {
  129.     gxContainsFormsBegin        = 0x0001,
  130.     gxContainsFormsEnd            = 0x0002,
  131.     gxContainsPostScript        = 0x0004,
  132.     gxContainsEmptyPostScript    = 0x0008
  133. };
  134.  
  135. typedef long                             gxTranslationStatistic;
  136. enum {
  137.     gxQuickDrawPictTag            = FOUR_CHAR_CODE('pict')
  138. };
  139.  
  140.  
  141. struct gxQuickDrawPict {
  142.                                                                 /* translator inputs */
  143.     gxTranslationOption             options;
  144.     Rect                             srcRect;
  145.     Point                             styleStretch;
  146.  
  147.                                                                 /* size of quickdraw picture data */
  148.     unsigned long                     dataLength;
  149.  
  150.                                                                 /* file alias */
  151.     gxBitmapDataSourceAlias         alias;
  152. };
  153. typedef struct gxQuickDrawPict            gxQuickDrawPict;
  154. /* WindowRecord utilities */
  155. EXTERN_API_C( gxViewPort )
  156. GXNewWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0236, 0xA832);
  157.  
  158. EXTERN_API_C( gxViewPort )
  159. GXGetWindowViewPort                (WindowPtr                 qdWindow)                            THREEWORDINLINE(0x303C, 0x0237, 0xA832);
  160.  
  161. EXTERN_API_C( WindowPtr )
  162. GXGetViewPortWindow                (gxViewPort             portOrder)                            THREEWORDINLINE(0x303C, 0x0238, 0xA832);
  163.  
  164. /* GDevice utilities */
  165. EXTERN_API_C( GDHandle )
  166. GXGetViewDeviceGDevice            (gxViewDevice             theDevice)                            THREEWORDINLINE(0x303C, 0x0239, 0xA832);
  167.  
  168. EXTERN_API_C( gxViewDevice )
  169. GXGetGDeviceViewDevice            (GDHandle                 qdGDevice)                            THREEWORDINLINE(0x303C, 0x023A, 0xA832);
  170.  
  171. /* gxPoint utilities */
  172. EXTERN_API_C( void )
  173. GXConvertQDPoint                (const Point *            shortPt,
  174.                                  gxViewPort             portOrder,
  175.                                  gxPoint *                fixedPt)                            THREEWORDINLINE(0x303C, 0x023B, 0xA832);
  176.  
  177. typedef CALLBACK_API_C( OSErr , gxShapeSpoolProcPtr )(gxShape toSpool, long refCon);
  178. /* printing utilities typedef */
  179. typedef CALLBACK_API_C( void , gxUserViewPortFilterProcPtr )(gxShape toFilter, gxViewPort portOrder, long refCon);
  180. typedef CALLBACK_API_C( long , gxConvertQDFontProcPtr )(gxStyle dst, long txFont, long txFace);
  181. typedef STACK_UPP_TYPE(gxShapeSpoolProcPtr)                     gxShapeSpoolUPP;
  182. typedef STACK_UPP_TYPE(gxUserViewPortFilterProcPtr)             gxUserViewPortFilterUPP;
  183. typedef STACK_UPP_TYPE(gxConvertQDFontProcPtr)                     gxConvertQDFontUPP;
  184. #if OPAQUE_UPP_TYPES
  185.     EXTERN_API(gxShapeSpoolUPP)
  186.     NewgxShapeSpoolUPP               (gxShapeSpoolProcPtr        userRoutine);
  187.  
  188.     EXTERN_API(gxUserViewPortFilterUPP)
  189.     NewgxUserViewPortFilterUPP       (gxUserViewPortFilterProcPtr userRoutine);
  190.  
  191.     EXTERN_API(gxConvertQDFontUPP)
  192.     NewgxConvertQDFontUPP           (gxConvertQDFontProcPtr    userRoutine);
  193.  
  194.     EXTERN_API(void)
  195.     DisposegxShapeSpoolUPP           (gxShapeSpoolUPP            userUPP);
  196.  
  197.     EXTERN_API(void)
  198.     DisposegxUserViewPortFilterUPP    (gxUserViewPortFilterUPP userUPP);
  199.  
  200.     EXTERN_API(void)
  201.     DisposegxConvertQDFontUPP       (gxConvertQDFontUPP        userUPP);
  202.  
  203.     EXTERN_API(OSErr)
  204.     InvokegxShapeSpoolUPP           (gxShape                    toSpool,
  205.                                     long                    refCon,
  206.                                     gxShapeSpoolUPP            userUPP);
  207.  
  208.     EXTERN_API(void)
  209.     InvokegxUserViewPortFilterUPP    (gxShape                toFilter,
  210.                                     gxViewPort                portOrder,
  211.                                     long                    refCon,
  212.                                     gxUserViewPortFilterUPP    userUPP);
  213.  
  214.     EXTERN_API(long)
  215.     InvokegxConvertQDFontUPP       (gxStyle                    dst,
  216.                                     long                    txFont,
  217.                                     long                    txFace,
  218.                                     gxConvertQDFontUPP        userUPP);
  219.  
  220. #else
  221.     enum { uppgxShapeSpoolProcInfo = 0x000003E1 };                     /* 2_bytes Func(4_bytes, 4_bytes) */
  222.     enum { uppgxUserViewPortFilterProcInfo = 0x00000FC1 };             /* no_return_value Func(4_bytes, 4_bytes, 4_bytes) */
  223.     enum { uppgxConvertQDFontProcInfo = 0x00000FF1 };                 /* 4_bytes Func(4_bytes, 4_bytes, 4_bytes) */
  224.     #define NewgxShapeSpoolUPP(userRoutine)                         (gxShapeSpoolUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxShapeSpoolProcInfo, GetCurrentArchitecture())
  225.     #define NewgxUserViewPortFilterUPP(userRoutine)                 (gxUserViewPortFilterUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxUserViewPortFilterProcInfo, GetCurrentArchitecture())
  226.     #define NewgxConvertQDFontUPP(userRoutine)                         (gxConvertQDFontUPP)NewRoutineDescriptor((ProcPtr)(userRoutine), uppgxConvertQDFontProcInfo, GetCurrentArchitecture())
  227.     #define DisposegxShapeSpoolUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  228.     #define DisposegxUserViewPortFilterUPP(userUPP)                 DisposeRoutineDescriptor(userUPP)
  229.     #define DisposegxConvertQDFontUPP(userUPP)                         DisposeRoutineDescriptor(userUPP)
  230.     #define InvokegxShapeSpoolUPP(toSpool, refCon, userUPP)         (OSErr)CALL_TWO_PARAMETER_UPP((userUPP), uppgxShapeSpoolProcInfo, (toSpool), (refCon))
  231.     #define InvokegxUserViewPortFilterUPP(toFilter, portOrder, refCon, userUPP)  CALL_THREE_PARAMETER_UPP((userUPP), uppgxUserViewPortFilterProcInfo, (toFilter), (portOrder), (refCon))
  232.     #define InvokegxConvertQDFontUPP(dst, txFont, txFace, userUPP)     (long)CALL_THREE_PARAMETER_UPP((userUPP), uppgxConvertQDFontProcInfo, (dst), (txFont), (txFace))
  233. #endif
  234. /* support for pre-Carbon UPP routines: NewXXXProc and CallXXXProc */
  235. #define NewgxShapeSpoolProc(userRoutine)                         NewgxShapeSpoolUPP(userRoutine)
  236. #define NewgxUserViewPortFilterProc(userRoutine)                 NewgxUserViewPortFilterUPP(userRoutine)
  237. #define NewgxConvertQDFontProc(userRoutine)                     NewgxConvertQDFontUPP(userRoutine)
  238. #define CallgxShapeSpoolProc(userRoutine, toSpool, refCon)        InvokegxShapeSpoolUPP(toSpool, refCon, userRoutine)
  239. #define CallgxUserViewPortFilterProc(userRoutine, toFilter, portOrder, refCon) InvokegxUserViewPortFilterUPP(toFilter, portOrder, refCon, userRoutine)
  240. #define CallgxConvertQDFontProc(userRoutine, dst, txFont, txFace) InvokegxConvertQDFontUPP(dst, txFont, txFace, userRoutine)
  241.  
  242. typedef gxShapeSpoolProcPtr             gxShapeSpoolFunction;
  243. typedef gxUserViewPortFilterProcPtr     gxUserViewPortFilter;
  244. typedef gxConvertQDFontProcPtr             gxConvertQDFontFunction;
  245. /* mouse utilities */
  246. /* return mouse location in fixed-gxPoint global space */
  247. EXTERN_API_C( void )
  248. GXGetGlobalMouse                (gxPoint *                globalPt)                            THREEWORDINLINE(0x303C, 0x023C, 0xA832);
  249.  
  250. /* return fixed-gxPoint local mouse (gxViewPort == 0 --> default) */
  251. EXTERN_API_C( void )
  252. GXGetViewPortMouse                (gxViewPort             portOrder,
  253.                                  gxPoint *                localPt)                            THREEWORDINLINE(0x303C, 0x023D, 0xA832);
  254.  
  255. /* printing utilities */
  256. EXTERN_API_C( gxUserViewPortFilterUPP )
  257. GXGetViewPortFilter                (gxViewPort             portOrder,
  258.                                  long *                    refCon)                                THREEWORDINLINE(0x303C, 0x025E, 0xA832);
  259.  
  260. EXTERN_API_C( void )
  261. GXSetViewPortFilter                (gxViewPort             portOrder,
  262.                                  gxUserViewPortFilterUPP  filter,
  263.                                  long                     refCon)                                THREEWORDINLINE(0x303C, 0x023E, 0xA832);
  264.  
  265. /* QD to QD GX Translator functions */
  266. EXTERN_API_C( void )
  267. GXInstallQDTranslator            (GrafPtr                 port,
  268.                                  gxTranslationOption     options,
  269.                                  const Rect *            srcRect,
  270.                                  const Rect *            dstRect,
  271.                                  Point                     styleStrech,
  272.                                  gxShapeSpoolUPP         userFunction,
  273.                                  void *                    reference)                            THREEWORDINLINE(0x303C, 0x023F, 0xA832);
  274.  
  275. EXTERN_API_C( gxTranslationStatistic )
  276. GXRemoveQDTranslator            (GrafPtr                 port,
  277.                                  gxTranslationStatistic * statistic)                        THREEWORDINLINE(0x303C, 0x0240, 0xA832);
  278.  
  279. EXTERN_API_C( gxShape )
  280. GXConvertPICTToShape            (PicHandle                 pict,
  281.                                  gxTranslationOption     options,
  282.                                  const Rect *            srcRect,
  283.                                  const Rect *            dstRect,
  284.                                  Point                     styleStretch,
  285.                                  gxShape                 destination,
  286.                                  gxTranslationStatistic * stats)                            THREEWORDINLINE(0x303C, 0x0241, 0xA832);
  287.  
  288. /* Find the best GX style given a QD font and face. Called by the QD->GX translator */
  289. EXTERN_API_C( long )
  290. GXConvertQDFont                    (gxStyle                 theStyle,
  291.                                  long                     txFont,
  292.                                  long                     txFace)                                THREEWORDINLINE(0x303C, 0x0242, 0xA832);
  293.  
  294. EXTERN_API_C( gxConvertQDFontUPP )
  295. GXGetConvertQDFont                (void)                                                        THREEWORDINLINE(0x303C, 0x0243, 0xA832);
  296.  
  297. EXTERN_API_C( void )
  298. GXSetConvertQDFont                (gxConvertQDFontUPP     userFunction)                        THREEWORDINLINE(0x303C, 0x0244, 0xA832);
  299.  
  300. typedef unsigned long                     gxProfilePoolAttributes;
  301.  
  302. struct gxFlatProfileListItem {
  303.     gxProfilePoolAttributes         attributes;                    /* information about this particular profile's source*/
  304.     CMProfileRef                     profileRef;                    /* reference to profile, only valid before shape is disposed*/
  305.     CMProfileIdentifier             identifier;                    /* information on how to find the profile upon unflattening*/
  306. };
  307. typedef struct gxFlatProfileListItem    gxFlatProfileListItem;
  308.  
  309.  
  310. #if defined(__MWERKS__) && TARGET_CPU_68K
  311.     #pragma pop
  312. #endif
  313.  
  314. #if PRAGMA_STRUCT_ALIGN
  315.     #pragma options align=reset
  316. #elif PRAGMA_STRUCT_PACKPUSH
  317.     #pragma pack(pop)
  318. #elif PRAGMA_STRUCT_PACK
  319.     #pragma pack()
  320. #endif
  321.  
  322. #ifdef PRAGMA_IMPORT_OFF
  323. #pragma import off
  324. #elif PRAGMA_IMPORT
  325. #pragma import reset
  326. #endif
  327.  
  328. #ifdef __cplusplus
  329. }
  330. #endif
  331.  
  332. #endif /* __GXENVIRONMENT__ */
  333.  
  334.